﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ztn_iot_sdk_cSharp.req;
using ztn_iot_sdk_cSharp.res;

namespace ztn_iot_sdk_cSharp.tool
{
    class IotDeviceSensorDataTool
    {
        private  const string BASE_PATH = "iot/api/v1/v1/device/sensor/data/";

        public static List<DeviceSensorData> list(DeviceSensorDataListReq req)
        {
            string path = BASE_PATH + "list";
            BaseRes<List<DeviceSensorData>> res = HttpTool.doPost<BaseRes<List<DeviceSensorData>>>(path, JsonTool.toJson(req));
            if (null != res && null != res.data)
            {
                return res.data;
            }
            return new List<DeviceSensorData>();
        }

        public static SensorDataWithExplain listWithExplain(DeviceSensorDataListReq req)
        {
            string path = BASE_PATH + "listWithExplain";
            BaseRes<SensorDataWithExplain> res = HttpTool.doPost<BaseRes<SensorDataWithExplain>>(path, JsonTool.toJson(req));
            if (null != res && null != res.data)
            {
                return res.data;
            }
            return null;
        }
    }
}
